This document shows some of the work that I have done for a course on social networks at the KU Leuven. The first part consits of three figures from the exploratory analysis of a international trade network. Specifically, I analysed the international manufacturing trade network at the country level for 2005.
The second part analyses the friendship network in a hungarian high school class and its evolution. This part compares the friendship network to a simulated random network. Second, it compares the fit of a statistical network model to the friendship network.
The total degree distribution shows that the countries with many trade ties account for a large share of the total number of trade relationships. Moreover, the figure shows that the total degree distrubtion is less skewed compared to the in and out-degree distrbution.
In the figure above we compare two approaches to identify interesting substructures in the international manufacturing trade network. In the left subfigure we color coded the countries according to their communities as identified by the louvain community detection algorithm. In the right subfigure we color coded each node according to which maximum group of nodes who are connected to some number (k) of other group members. Intuitively, the idea is that a node may connected to a group if it has many ties to the members of a group.
This section shows several plots of the affective network. Each node is a pupil and each edge represents a friendship nomination in the survey. Further, we use colors to distinguish the nodes by gender. The color red represents the gender male and the color black represents the gender female.
We use random graphs with the same density to analyze the friendship (affective) class network.
The figure above displays the simulated random networks. The left subfigure is the simulated network from wave 1. The right subfigure is the simulated network from wave 2.
The figure above shows the real and the simulated random network for wave 1. The left subfigure displays the real network in wave 1. The right subfigure displays the simulated random network in wave 1.
par(mfrow=c(1,2))
gplot(affective_w2)
gplot(random.nets.2) # looks quite homogeneous, maybe too much
The figure above shows the real and the simulated random network for wave 2. The left subfigure displays the real network in wave 2. The right subfigure displays the simulated random network in wave 2.
The next figure compares the distribution of all closed triangles in the random network to the real network using violinplots.
The violinplot combines the box plot with a density plot. It thus display the complete data distribution.
Further, a word about why we display closed triangels. Closed triangles are interesting because they measure the extend that a friend of my friend is also my friend.
The violinplot below shows the distribution of the closed triangels in the simulated random network. Overall, the figure shows substaintial differences between the real network (red dots) and the simulated network. This approach is of comparing the real network to a simulated random network is similar to a null hypothesis test. The takeaway is that the real network is unlikely to be random.
A short explanation about dyads.
A dyad is a subnetwork of only two nodes. There are three relevant states for each dyad. Mutual dyads describe in our context that two pupils nominated each other as a friend. Asym. dyads describes here that only one pupil named the other one as a friend. A nully dyad describes that both pupils did not nominate each other as a friend.
The figures above compare the dyad distribution of the simulated random network to the real network.
In short the figure shows that the wave 2 friendship network has more mutual and (alot) less asym and null dyads than in the random network. The takeaway is that the real network is unlikely to be random.
In this part we estimated an expontential random graph model (ERGM). In short the ERGM is an extension of the logistic regression to the case of networks.
The ERGM model predicts the presence of edges on the basis of covariates, as e.g. are there more boys than girls, and network structures as e.g. transitivity.
In the following present two visualisations comparing the fit of the estimated ERGM model to the real friendship network using simulations.
Below we compare the distribution of all closed triangles from 100 simulations of the fitted ERGM model to the real network.
Overall, the figure shows a that our model fits reasonably well the distribution of closed triangles. The red squares are all quite reasonably in line with the simulated values display in the violplots.
Next, I visually inspect the models predictions for the dyad distributions. Overall, it is encouraging to see that our model fits the mutual dyads and the asynm. dyads reasonably well. However, our model predicts too many null dyads compared to the real network.